CC=clang
CFLAGS=-O3 -march=native -Wall -std=c99 -g -msse3
LDFLAGS=

TARGETS=demo headless
SOURCES=$(shell echo *.c)
COMMON_OBJECTS=timing.o solver.o

all: $(TARGETS)

demo: demo.o $(COMMON_OBJECTS)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) -lGL -lGLU -lglut

headless: headless.o $(COMMON_OBJECTS)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)

clean:
	rm -f $(TARGETS) $(COMMON_OBJECTS) .depend *~

.depend: *.[ch]
	$(CC) -MM -msse3 $(SOURCES) >.depend

-include .depend

.PHONY: clean all
